John has got jars with candies.
Each of the jars contains a different kind of candies
(i.e. candies from the same jar are of the same kind, and
candies from different jars are of different kinds).
The -th jar contains candies.
John has decided to eat some of his candies.
He would like to eat at least of them but no more than .
The problem is that John can't decide how many candies and of
what kinds he would like to eat.
In how many ways can he do it?
Task
Your task is to write a program that:
reads from the standard input the amount of candies in each of the
jars, and integers and ,
determines the number of ways John can choose the candies
he will eat (satisfying the above conditions),
writes the result to the standard output
Input
The first line of input contains three integers:
, and , separated by single spaces
(, ).
Each of the following lines contains one integer.
Line contains integer -
the amount of candies in the -th jar
().
Output
Let be the number of different ways John can choose
the candies to be eaten.
The first and only line of output should contain one integer:
mod 2004 (i.e. the remainder of divided by 2004).
Example
For the input data:
2 1 3
3
5
the correct result is:
9
John can choose candies in the following ways:
Task author: Marcin Michalski.
Kontakt
In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.